package com.gph.saviorframework.dao.security;

import com.gph.saviorframework.base.dao.BaseDao;
import com.gph.saviorframework.common.model.Menu;
import org.apache.ibatis.annotations.Param;
import org.aspectj.lang.annotation.Aspect;

import java.util.List;
import java.util.Map;

@Aspect
public interface MenuDao extends BaseDao<Menu,String> {


    /**
     * 根据上级菜单编号查找子菜单
     * @param parentId
     * @param username 当前登录用户
     * @return
     */
    List<Map<String, Object>> findByParent(@Param(value = "parentId") String parentId,
                                           @Param(value = "username") String username);

    /**
     * 根据上级编号获取菜单列表
     * @param parentId
     * @return
     */
    List<Map<String, Object>> findMenusByParent(@Param(value = "parentId") String parentId);

    /**
     * 根据角色和上级菜单查询
     * @param parentId
     * @param roleId
     * @return
     */
    List<Map<String, Object>> findByRole(@Param(value = "parentId") String parentId,
                                         @Param(value = "roleId") String roleId);

    /**
     * 查询结果集
     * @param sort
     * @param dir
     * @param whereClause
     * @return
     */
    List<Map<String,Object>> find(@Param(value = "sort") String sort, @Param(value = "dir") String dir,
                                  @Param(value = "where_clause") String whereClause);

    /**
     * 返回结果集数量
     * @param whereClause
     * @return
     */
    long count(@Param(value = "where_clause") String whereClause);
}
